package com.zhongkai.web.control.book;
import java.io.PrintWriter;
import java.util.Date;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import com.zhongkai.model.book.TDjCcdjxx;
import com.zhongkai.service.CommonService;
import com.zhongkai.service.book.AdjustTaxService;
import com.zhongkai.tools.CheckWord;
import com.zhongkai.tools.DateManageTool;

@Controller
public class AdjustTaxControl extends ParamType{
	private AdjustTaxService adjustTaxService;
	@RequestMapping("/system/book/car_adjusttax.do")
	public String adjustTax(Integer ccdjh,String adjusttax_date, String reason,HttpServletRequest request,HttpServletResponse response) throws Exception{
		PrintWriter out=response.getWriter();
		if(reason==null||"".equals(reason)){
			out.write(CheckWord.showMsg("调整依据不能为空，请填写!", "/system/book/car_adjusttax_form.jsp?ccdjh="+ccdjh));
			return null;
		}
		if(!DateManageTool.isRig(adjusttax_date)){
			out.write(CheckWord.showMsg("应税起始日期格式错误!,请修改", "/system/book/car_adjusttax_form.jsp?ccdjh="+ccdjh));
			return null;
		}
		TDjCcdjxx tDjCcdjxx=(TDjCcdjxx) adjustTaxService.findById(new TDjCcdjxx(), ccdjh);
		boolean flag=adjustTaxService.adjustTax_dateTransaction(tDjCcdjxx, adjusttax_date, reason,request);
		if(flag){
			out.write(CheckWord.showMsg("应税年月调整成功，请查看!", "/system/book/car_adjusttax_form.jsp?ccdjh="+ccdjh,request));
			return null;
		}else{
			out.write(CheckWord.showMsg("系统正在维护，不便之处，请原谅!", "/system/book/car_adjusttax_form.jsp?ccdjh="+ccdjh,request));
			return null;
		}
	}
	
	public AdjustTaxService getAdjustTaxService() {
		return adjustTaxService;
	}
	@Resource
	public void setAdjustTaxService(AdjustTaxService adjustTaxService) {
		this.adjustTaxService = adjustTaxService;
	}
	
	
	
	
	
	

}
